Elevator Pitch

  • For developers wishing to get practice creating systems using TDD
  • Who are interested in starting with user stories that follow the INVEST principle
  • Our RPN Calculator problem is a complete problem
  • That gives users a rich enough to practice simple TDD
  • Unlike other problems that take you through the process step by step
  • Our Product only provides the starting point from which you are expected to begin practicing

User Stories

The following list of user stories form a Product Backlog. The are additionally sectioned by Releases, each of which is given a Theme.

Release 1 - Theme: Basic Math


Release 2 - Theme: Stack Management


Release 3 - Theme: Advanced Math


Alternative Approach

As I've Actually Taught It

Getting Started


Here are some steps to get you started:
Project Setup
  1. Create a workspace in eclipse
  2. Make sure to have separate source folders, one called src, one called test
  3. Add JUnit lib to your project's classpath

TDD
  1. Pick the highest listed user uncompleted user story
    • Create a test for the first uncompleted UAT
    • Get the test to compile
    • Get the test to run
    • Refactor if necessary
    • Check in your source code
  2. Repeat until all UAT's are done for the current user story
  3. Repeat until all user stories for the current release are finished

RpnCalculatorCppExampleImplementation



Release 1

Addition

As a user, I want to be able to add two numbers so that I don't have to do the work manually

UAT

  • [] 8 <enter> 5 <plus> -> [13]
  • [] 8 <enter> <plus> -> [8]
  • [] 8 <plus> -> [8]
  • [] -3 <enter> 7 <plus> -> [4]
  • [4, 5, 3] <plus> -> [4, 8] <plus> -> [12] <plus> -> [12]

<--Back

Subtraction

As a user, I want to be able to subtract two numbers so that I don't have to do the work manually

UAT

  • [] 8 <enter> 5 <minus> -> [3]
  • [] -3 <enter> -9 <minus> -> [6]
  • [] 4.2 <enter> 2.3 <minus> -> [1.9]
  • [] 3 <minus> -> [-3]
  • [] <minus> -> [0]


<--Back

Multiplication

As a user, I want to be able to multiple two numbers so that I don't have to do the work manually

UAT

  • [] 8 <enter> 5 <times> -> [40]
  • [] 8 <enter> <times> -> [0]
  • [] -4 <enter> 2 <times> -> [-8]
  • [] .5 <enter> 10 <times> -> [5]
  • [] -7 <enter> -1 <times> -> [7]

<--Back

Division

As a user, I want to be able to divide two numbers so that I don't have to do the work manually

UAT

  • [] 4 <enter> 2 <divide> -> [2]
  • [] 3 <enter> 2 <divide> -> [1.5]
  • [] -4 <enter> -8 <divide> -> [.5]
  • [] 0 <enter> 5 <divide> -> [0]
  • [] 4 <enter> 0 <divide> -> division by zero error

<--Back

Release 2

Review Stack

As a user I want to be able to review the contents of the stack so that I can confirm my numbers.

UAT

  • [] 3 <enter> 4 <enter> <display> -> [3, 4]
  • [] <display> -> []
  • [] 6 <display> [6]

<--Back

Clear Stack

As a user I want to be able to clear all values on the stack so that I can start from scratch whenever I want.

UAT

  • [] <clear> --> []
  • [5, 4, 3] <clear> --> []

<--Back

Insert into Stack

As a user I want to be able to insert a new number after an existing number on the stack so that I can add something in I forgot.

UAT

  • [6, 4, 19, 6, 8] 3 <enter> 311 <insert> -> [6, 4, 311, 19, 6, 8]
  • [41] 1 <enter> 19 <insert> -> [19, 41]
  • [] 4 <enter> 19 <insert> --> []/error

<--Back

Replace Item on Stack

As a user I wan to be able to replace one entry on the stack with another so that I can fix a typing error.

UAT

  • [33, 2, 9] 1 <enter> 777 <replace> -> [33, 2, 777]
  • [] 2 <enter> 6 <replace> -> index error

<--Back

Release 3

Square Root

As a user I want to be able to take the square root of a number so that I don't have to calculate it manually.

UAT

  • [4] <sqrt> -> [2]
  • [-4] <sqrt> -> error invalid number/[] (if you want to experiment with imaginary numbers, feel free to do so)

<--Back

Y to X

As a user I want to be able to raise one number to the power of another number so that I don't have to calculate this manually.

UAT

  • [] 6 <enter> 3 <YtoX> -> [216]
  • [] -6 <enter> 2 <YtoX> -> [36]
  • [] -6 <enter> 3 <YtoX> -> [-216]

<--Back

1 over X

As a user I want to be able to take a 1 over a number so that if I happen to divide in the wrong direction I can reverse the results to fix it rather than recalculating the division.

UAT

  • [] 10 <enter> <1overX> -> [.1]
  • [] .2 <enter> <1overX> -> [5]
  • [] -5 <enter> <1overX> -> [-.2]

<--Back

Sin

As a user I want to be able to calculate the sin of an angle in degrees so that I don't have to perform the calculation manually.


UAT

  • [0] <sin> -> [0]
  • [45] <sin> -> [.7071]
  • [90] <sin> -> [1]
  • [180] <sin> -> [0]
  • [270] <sin> -> [-1]

<--Back

Cos

As a user I want to be able to calculate the cos of an angle in degrees so that I don't have to perform the calculation manually.


UAT

  • [0] <cos> -> [1]
  • [45] <cos> -> [.7071]
  • [90] <cos> -> [0]
  • [180] <cos> -> [-1]
  • [270] <cos> -> [0]

<--Back

Tan

As a user I want to be able to calculate the tan of an angle in degrees so that I don't have to perform the calculation manually.


UAT

  • [0] <tan> -> [0]
  • [45] <tan> -> [1]
  • [90] <tan> -> error/[]
  • [180] <tan> -> [0]
  • [270] <tan> -> error/[]

<--Back

Exponentials

As a user I can use exponential notation to enter large numbers so I do not have to enter large numbers and possibly make a mistake.

UAT

  • [] 2 <e> 3 <enter> -> [2000]
  • [] <e> 6 <enter> -> [1000000]
  • [] 1.2 <e> 4 <enter> -> [12000]
  • [] -4 <e> 5 <enter> -> [-400000]
  • [] 20 <e> -1 <enter> -> [2]

<--Back

Factorials

As a user I can calculate factorials (x!) for whole numbers.

UAT

  • [] 3 <enter> <fac> -> [6]
  • [2] <fac> -> [2]
  • [8] <fac> -> [40320]

<--Back